<?php
$http = new swoole_http_server('0.0.0.0',8080);
$http->set([
    'enable_static_handler' => true,
    'document_root' => '/home/centos/public_html/sw/demo/html'
]);
$http->on('request',function($request,$response){

    echo '<pre>';
    print_r($request->get);
    echo '</pre>';
    $response->cookie('id',109,time()+7200,'/');
   $response->end(json_encode($request->get));
});

$http->start();